package test.bean;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.sql.DataSource;

public interface JDBCUtils {
	
	 /**
	  * @param conn  ���ӳ�����  
	  * <p>
	  */
	public void setDataSource(DataSource dataSource); 
	 
	
	 /**
	  * @param conn ��ݿ���������  
	  * <p>
	  */
	public void setConnection(Connection connection) ;
	
	
	 /**
	  * @param conn ��ݿ���������  
	  * <p>
	  * @param objTable ��������
	  * <p>
	  * @param PrimaryKey �ֶ����(����)
	  * <p>
	  *  @param PrimaryKey �ֶ�ֵ(����)
	  * <p>
	  */
//		public  void  deleteByPrimaryKey  (Connection conn,  Class<?> objTable, 
//			Object   PrimaryKey ,Object PrimaryValue) throws  Exception;
		public  void  deleteByPrimaryKey  (Class<?> objTable, Object   PrimaryKey ,Object PrimaryValue) throws  Exception;
	
	 /**
	  * @param conn ��ݿ���������  
	  * <p>
	  * @param objTable ��������
	  * <p>
	  * @param PrimaryKey �ֶ����(����)
	  * <p>
	  *  @param PrimaryKey ����ֶ�ֵ(����)
	  * <p>
	  */
//		public  void  deleteObjectsByPrimaryKeys (Connection conn, Class<?> objTable, 
		public  void  deleteObjectsByPrimaryKeys ( Class<?> objTable, 
			Object  PrimaryKey,Object [] PrimaryValues ) throws  Exception;
	
	
	/**
	 *  �����¼����
	 * <p>
	 * @param conn  ��ݿ���������  
	 * <p>
	 * @param objTable  ʵ�� (new)  pojo ����
	 */
//	public void addObject(Connection conn, Object objTable  ) throws  Exception;
		public void addObject( Object objTable  ) throws  Exception;
	/**
	 * <p>
	 * @param conn  ��ݿ��������� 
	 *  <p>
	 * @param Object []    ��������Ķ�������
	 *  <p>
	 */
//	public  void  addBatchObjects (Connection conn,   Object []  objTables ) throws  Exception;
	public  void  addBatchObjects (Object []  objTables ) throws  Exception;
	
	/**
	 * <p>
	 * @param conn  ��ݿ��������� 
	 *  <p>
	 * @param String  ִ�е�SQL���
	 *  <p>
	 * @param objTable  ʵ�� (new)  pojo ����
	 */
//	public Map<?, ?>  queryMap (Connection conn,  String SQL ) throws  Exception ;
	public Map<?, ?>  queryMap ( String SQL ) throws  Exception ;
	
	/**
	 * <p>
	 * @param conn  ��ݿ���������  
	 * <p>
	 * @param String  ִ�е�SQL���
	 * <p>
	 * @param objTable  ʵ�� (new)  pojo ����
	 * <p>
	 * @param param  ��ѯ����
	 */
//	 public Map<?, ?>  queryMapByCondition (Connection conn,  String SQL,  Object [] param ) throws  Exception;
	public Map<?, ?>  queryMapByCondition (  String SQL,  Object [] param ) throws  Exception;
	
	/**
	 * <p>
	 * @param conn  ��ݿ���������  
	 * <p>
	 * @param String  ִ�е�SQL���
	 * <p>
	 * @param objTable  ʵ�� (new)  pojo ����
	 * <p>
	 * @param param  ��ѯ����
	 */
//	public List<?> queryListByCondition (Connection conn,  String SQL, Class<?> objTable,Object [] param ) throws  Exception;
	public List<?> queryListByCondition (  String SQL, Class<?> objTable,Object [] param ) throws  Exception;
	/**
	 * <p>
	 * @param conn  ��ݿ���������  
	 * <p>
	 * @param String  ִ�е�SQL���
	 * <p>
	 * @param objTable  ʵ�� (new)  pojo ����
	 */
	public List<?> queryList (  String SQL, Class<?> objTable ) throws  Exception;
	
	
	/**
	 * <p>
	 * @param conn  ��ݿ���������  
	 * <p>
	 * @param String  ִ�е�SQL���
	 * <p>
	 * @param objTable  ʵ�� (new)  pojo ����
	 */
//	public Object  queryOneObject ( Connection conn,  String SQL, Class<?> objTable ) throws  Exception;
	public Object  queryOneObject (  String SQL, Class<?> objTable ) throws  Exception;
	
	
	/**
	 * <p>
	 * @param conn  ��ݿ���������  
	 * <p>
	 * @param String  ִ�е�SQL���
	 * <p>
	 * @param objTable  ʵ�� (new)  pojo ����
	 * <p>
	 * @param param  ��ѯ����
	 */
//	public Object  queryOneObjectByCondition ( Connection conn,  String SQL, Class<?> objTable, Object [] param )
	public Object  queryOneObjectByCondition (  String SQL, Class<?> objTable, Object [] param )
				throws  Exception;
	
	
	/**<p>
	 * @param conn  ��ݿ���������  
	 * <p>
	 * @param String  ִ�е�SQL���
	 */
//	public void updateObjectBySQL(Connection conn, String SQL  ) throws SQLException;
	public void updateObjectBySQL( String SQL  ) throws SQLException;
	
	/**
	 * <p>
	 * @param conn  ��ݿ���������  
	 * <p>
	 * @param objTable  ʵ�� (new)  pojo ����
	 * <p>
	 * @param KeyColumn  ���������ֶ����
	 * <p>
	 * @param KeyValue	  ���������ֶ�ֵ
	 */
//	public void updateObjectByPrimaryKey(Connection conn, Object objTable,String KeyColumn,Object KeyValue  ) throws  Exception ;
	public void updateObjectByPrimaryKey( Object objTable,String KeyColumn,Object KeyValue  ) throws  Exception ;
	
	/**
	 * ��������
	 * @param conn
	 * @throws Exception 
	 */
//	public void endTransaction( Connection conn) throws Exception ;
	public void endTransaction(  ) throws Exception ;
	
	/**
	 * ��������
	 * @param conn
	 */
//	public void startTransaction( Connection conn) ;
	public void startTransaction() throws Exception ;

}
